﻿using Main.Model;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Main
{
    public partial class Main : Form
    {
        private List<WordTestInfo> wordTests = new List<WordTestInfo>();
        public Main()
        {
            InitializeComponent();
        }

        private void btWordTranslation_Click(object sender, EventArgs e)
        {

            Word.AddNewWord(new WordInfo("by bus", "乘坐公交汽车", 年级.二));
            Word.AddNewWord(new WordInfo("by minibus", "乘坐小巴", 年级.二));
            Word.AddNewWord(new WordInfo("by school bus", "乘坐校车", 年级.二));
            Word.AddNewWord(new WordInfo("by metro", "乘坐地铁", 年级.二));
            Word.AddNewWord(new WordInfo("by car", "乘坐小汽车", 年级.二));
            Word.AddNewWord(new WordInfo("by taxi", "乘坐的士", 年级.二));
            Word.AddNewWord(new WordInfo("by ferry", "乘坐轮渡", 年级.二));
            Word.AddNewWord(new WordInfo("on foot", "步行", 年级.二));
            Word.AddNewWord(new WordInfo("by bicycle", "乘坐自行车", 年级.二));
            Word.AddNewWord(new WordInfo("by MTR ", "乘坐地铁", 年级.二));
            Word.AddNewWord(new WordInfo("by LRT ", "乘坐地铁", 年级.二));
            Word.AddNewWord(new WordInfo("by tram ", "乘坐有轨电车", 年级.二));
            Word.AddNewWord(new WordInfo("by train ", "乘坐火车", 年级.二));

            Word.AddNewWord(new WordInfo("how many", "多少", 年级.二));
            Word.AddNewWord(new WordInfo("in Beijing", "在北京", 年级.二));
            Word.AddNewWord(new WordInfo("on Hainan Island", "在海南岛", 年级.二));
            Word.AddNewWord(new WordInfo("telephone number", "电话号码", 年级.二));
            Word.AddNewWord(new WordInfo("Mr", "先生", 年级.二));
            Word.AddNewWord(new WordInfo("Mrs ", "夫人", 年级.二));
            Word.AddNewWord(new WordInfo("Miss ", "小姐", 年级.二));
            Word.AddNewWord(new WordInfo("kind", "善良的", 年级.二));
            Word.AddNewWord(new WordInfo("friendly ", "友好的", 年级.二));
            Word.AddNewWord(new WordInfo("helpful", "乐于助人的", 年级.二));
            Word.AddNewWord(new WordInfo("Chinese teacher", "语文老师", 年级.二));
            Word.AddNewWord(new WordInfo("Maths teacher", "数学老师", 年级.二));
            Word.AddNewWord(new WordInfo("English teacher", "英语老师", 年级.二));
            Word.AddNewWord(new WordInfo("PE teacher", "体育老师", 年级.二));
            Word.AddNewWord(new WordInfo("Music teacher", "音乐老师", 年级.二));
            Word.AddNewWord(new WordInfo("who", "谁", 年级.二));
            Word.AddNewWord(new WordInfo("where", "在哪儿", 年级.二));
            Word.AddNewWord(new WordInfo("bus driver ", "公交车司机", 年级.二));
            Word.AddNewWord(new WordInfo("cleaner", "清洁工", 年级.二));
            Word.AddNewWord(new WordInfo("caretaker", "看门人", 年级.二));
            Word.AddNewWord(new WordInfo("like  ", "喜欢", 年级.二));
            Word.AddNewWord(new WordInfo("my  ", "我的", 年级.二));
            Word.AddNewWord(new WordInfo("your  ", "你的", 年级.二));
            Word.AddNewWord(new WordInfo("a doctor  ", "医生", 年级.二));
            Word.AddNewWord(new WordInfo("a nurse  ", "护士", 年级.二));
            Word.AddNewWord(new WordInfo("a cook  ", "厨师", 年级.二));
            Word.AddNewWord(new WordInfo("a policeman   ", "男警察", 年级.二));
            Word.AddNewWord(new WordInfo("a policewoman  ", "女警察", 年级.二));
            Word.AddNewWord(new WordInfo("a waiter  ", "男服务员", 年级.二));
            Word.AddNewWord(new WordInfo("a waitress  ", "女服务员", 年级.二));
            Word.AddNewWord(new WordInfo("a housewife   ", "家庭主妇", 年级.二));
            Word.AddNewWord(new WordInfo("a dentist   ", "牙医", 年级.二));
            Word.AddNewWord(new WordInfo("a fireman    ", "消防员", 年级.二));
            Word.AddNewWord(new WordInfo("a fire station   ", "消防局", 年级.二));
            Word.AddNewWord(new WordInfo("job", "职业", 年级.二));
            Word.AddNewWord(new WordInfo("class teacher", "班主任", 年级.二));
            Word.AddNewWord(new WordInfo("climb the trees", "爬树", 年级.二));
            Word.AddNewWord(new WordInfo("walk on the grass", "在草地上走", 年级.二));
            Word.AddNewWord(new WordInfo("pick the flowers", "摘花", 年级.二));
            Word.AddNewWord(new WordInfo("feed the ducks", "喂鸭子", 年级.二));
            Word.AddNewWord(new WordInfo("throw litter", "扔垃圾", 年级.二));
            Word.AddNewWord(new WordInfo("make a noise", "发出噪音", 年级.二));
            Word.AddNewWord(new WordInfo("hungry", "饿的", 年级.二));
            Word.AddNewWord(new WordInfo("full", "饱的", 年级.二));
            Word.AddNewWord(new WordInfo("yummy ", "好吃的", 年级.二));
            Word.AddNewWord(new WordInfo("funny  ", "奇怪的，有趣的", 年级.二));
            Word.AddNewWord(new WordInfo("a playground ", "操场", 年级.二));
            Word.AddNewWord(new WordInfo("a pond ", "池塘", 年级.二));
            Word.AddNewWord(new WordInfo("a snack bar ", "小吃店", 年级.二));
            Word.AddNewWord(new WordInfo(" a tennis court ", "网球场", 年级.二));
            Word.AddNewWord(new WordInfo("a swimming pool ", "游泳池", 年级.二));
            Word.AddNewWord(new WordInfo("toilets ", "厕所", 年级.二));
            Word.AddNewWord(new WordInfo("exit", "出口", 年级.二));
            Word.AddNewWord(new WordInfo("a garden", "花园", 年级.二));
            Word.AddNewWord(new WordInfo("a see-saw", "跷跷板", 年级.二));
            Word.AddNewWord(new WordInfo("a slide", "滑梯", 年级.二));
            Word.AddNewWord(new WordInfo("a fish pond", "鱼塘", 年级.二));
            Word.AddNewWord(new WordInfo("in front of ", "在……前面", 年级.二));
            Word.AddNewWord(new WordInfo("behind ", "在……后面", 年级.二));
            Word.AddNewWord(new WordInfo("between…and…", "在……中间", 年级.二));
            Word.AddNewWord(new WordInfo("swing", "秋千", 年级.二));


            Word.AddNewWord(new WordInfo("How do you come to school?", "I come to school on foot./I walk to school./By metro ", 年级.二));
            Word.AddNewWord(new WordInfo("How many pupils come by bus?", " One pupil comes by car./Seven pupils come by school bus .", 年级.二));
            Word.AddNewWord(new WordInfo("How many pupils come by bus?", "秋千", 年级.二));
            Word.AddNewWord(new WordInfo("Hello.Where do you live ? ", "I live in Beijing .", 年级.二));
            Word.AddNewWord(new WordInfo("What’s your name ?", "My name is Kitty./I’m Mary .", 年级.二));
            Word.AddNewWord(new WordInfo("How old are you ?", "I’m seven .", 年级.二));
            Word.AddNewWord(new WordInfo("What’s your telephone number ?", "It’s 2023 4566 .", 年级.二));
            Word.AddNewWord(new WordInfo("Who’s your PE teacher ?", "My PE teacher is Mrs Lee . She’s kind . I like her .", 年级.二));
            Word.AddNewWord(new WordInfo("Who’s your Maths teacher ?", "My Maths teacher is Mr Wong . He’s kind .I like him .", 年级.二));
            Word.AddNewWord(new WordInfo("Who’s your bus driver ?", "My bus driver is Mr Mak .", 年级.二));
            Word.AddNewWord(new WordInfo("Do you like him?", "Yes , I do . He’s helpful and friendly .", 年级.二));
            Word.AddNewWord(new WordInfo("Who’s your caretaker ?", " My caretaker is Mrs Wu .", 年级.二));
            Word.AddNewWord(new WordInfo("Do you like her ?", "Yes , I do .She’s helpful and kind .", 年级.二));
            Word.AddNewWord(new WordInfo("What’s your father’s job ?", "He’s a waiter .", 年级.二));
            Word.AddNewWord(new WordInfo("What’s your mother’s job ? ", "She’s a housewife .", 年级.二));
            Word.AddNewWord(new WordInfo("Who’s your class teacher ? ", "Mr Chow is my class teacher.", 年级.二));
            Word.AddNewWord(new WordInfo("Don’t pick the flowers .", "Sorry", 年级.二));
            Word.AddNewWord(new WordInfo("Can we climb the trees ?  ", "No, we can’t . Look at the sign .It says : Do not climb the trees .", 年级.二));
            Word.AddNewWord(new WordInfo("Let’s follow the rules .", "She’s a housewife .", 年级.二));
            Word.AddNewWord(new WordInfo("Where is the playground ?  ", "It is between the pond and the garden . ", 年级.二));
            Word.AddNewWord(new WordInfo("Where are the toilets ?  ", "They are behind the garden .", 年级.二));
            Word.AddNewWord(new WordInfo("I want to wash my hands .", "Don’t wash your hands here . You can go to the toilets .", 年级.二));


            EnglishToChinese frm = new EnglishToChinese(Word.GetWords());
            frm.ShowDialog();
            wordTests = WordTestManager.GetWordTests();
            this.dataGridView1.DataSource = null;
            this.dataGridView1.DataSource = wordTests;
        }

        private void tabControl1_SelectedIndexChanged(object sender, EventArgs e)
        {

        }

        private void Main_Load(object sender, EventArgs e)
        {
            this.dataGridView1.AutoGenerateColumns = false;
            wordTests=WordTestManager.GetWordTests();
            this.dataGridView1.DataSource = wordTests;
        }

        private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            WordTestInfo wordTestInfo = wordTests[e.RowIndex];
            if (e.ColumnIndex == 4)
            {
              
              EnglishToChinese frm = new EnglishToChinese(wordTestInfo.WrongWords);
              frm.ShowDialog();
            }
            else if(e.ColumnIndex==5)
            {
                if(MessageBox.Show("确认删除吗?")==System.Windows.Forms.DialogResult.OK)
                {
                    WordTestManager.DelWordTest(wordTestInfo);
                    wordTests = WordTestManager.GetWordTests();
                    this.dataGridView1.DataSource = wordTests;
                }
            }

        }
    }
}
